| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkGraphics::RenderContextDescriptor Class Referencefinal

A descriptor, used when creating a context along with its window. More...

## Public Member Functions
| RenderContextDescriptor () noexcept
| RenderContextDescriptor (nkWinUi::Window *window, bool vsync=false) noexcept
| RenderContextDescriptor (Texture *colorTarget) noexcept
| RenderContextDescriptor (Texture *colorTarget, Texture *depthTarget) noexcept
| RenderContextDescriptor (unsigned int width, unsigned int height, bool forOffscreen, bool vsync=false) noexcept
unsigned int | getWidth () const
unsigned int | getHeight () const
nkWinUi::Window * | getWindow () const
Texture * | getColorTarget () const
Texture * | getDepthTarget () const
bool | getOffscreenContext () const
bool | getVsync () const
bool | getUseStencil () const
void | setUseStencil (bool v)

## Detailed Description

A descriptor, used when creating a context along with its window.

See RenderContextManager::createRenderContext() for more information.

## Constructor & Destructor Documentation

## ◆ RenderContextDescriptor() [1/5]

nkGraphics::RenderContextDescriptor::RenderContextDescriptor | ( |  | ) |
| noexcept

Default constructor.

## ◆ RenderContextDescriptor() [2/5]

nkGraphics::RenderContextDescriptor::RenderContextDescriptor | ( | nkWinUi::Window * | window,
|  | bool | vsync = `false`
| ) |  |
| noexcept

On window constructor.

Parameters

  window | The window the context described should render to.
  vsync | Whether the context described should use vsync (true) or not (false).

Remarks
  The context will be considered as rendering on screen, and size will be derived from the window given.

## ◆ RenderContextDescriptor() [3/5]

nkGraphics::RenderContextDescriptor::RenderContextDescriptor | ( | Texture * | colorTarget | ) |
| noexcept

On texture constructor. The texture will be used as the color target.

Parameters

  colorTarget | The texture the context described should render to.

Remarks
  The context will be considered as rendering off screen, and size will be derived from the texture given.

## ◆ RenderContextDescriptor() [4/5]

nkGraphics::RenderContextDescriptor::RenderContextDescriptor | ( | Texture * | colorTarget,
|  | Texture * | depthTarget
| ) |  |
| noexcept

On textures constructor.

Parameters

  colorTarget | The texture the context described should render to.
  depthTarget | The texture the context described should use as a depth buffer.

Remarks
  The context will be considered as rendering off screen, and size will be derived from the color target given.

## ◆ RenderContextDescriptor() [5/5]

nkGraphics::RenderContextDescriptor::RenderContextDescriptor | ( | unsigned int | width,
|  | unsigned int | height,
|  | bool | forOffscreen,
|  | bool | vsync = `false`
| ) |  |
| noexcept

Automatic constructor.

Parameters

  width | The width of the context described, in pixels.
  height | The height of the context described, in pixels.
  forOffscreen | Whether the context described should be off-screen (true) or not (false).
  vsync | Whether the context described should use vsync (true) or not (false). This can only work when rendering to a window.

Remarks
  For on-screen contexts, a window will be created, while off-screen contexts will create a texture. In both cases, the associated depth will also be created.

## Member Function Documentation

## ◆ getWidth()

unsigned int nkGraphics::RenderContextDescriptor::getWidth | ( |  | ) | const

Returns
  The width set into the descriptor.

Remarks
  The value returned won't be derived from a potential window or texture. Rather, it will be directly mapped to the value provided to the automatic constructor.

## ◆ getHeight()

unsigned int nkGraphics::RenderContextDescriptor::getHeight | ( |  | ) | const

Returns
  The height set into the descriptor.

Remarks
  The value returned won't be derived from a potential window or texture. Rather, it will be directly mapped to the value provided to the automatic constructor.

## ◆ getWindow()

nkWinUi::Window* nkGraphics::RenderContextDescriptor::getWindow | ( |  | ) | const

Returns
  The window set into the descriptor.

## ◆ getColorTarget()

Texture* nkGraphics::RenderContextDescriptor::getColorTarget | ( |  | ) | const

Returns
  The color target set into the descriptor.

## ◆ getDepthTarget()

Texture* nkGraphics::RenderContextDescriptor::getDepthTarget | ( |  | ) | const

Returns
  The depth target set into the descriptor.

## ◆ getOffscreenContext()

bool nkGraphics::RenderContextDescriptor::getOffscreenContext | ( |  | ) | const

Returns
  Whether the descriptor has been set as offscreen (true) or not (false).

Remarks
  The value returned won't be derived from a potential window or texture. Rather, it will be directly mapped to the value provided to the automatic constructor.

## ◆ getVsync()

bool nkGraphics::RenderContextDescriptor::getVsync | ( |  | ) | const

Returns
  Whether the descriptor has been set to use vertical sync (true) or not (false).

Remarks
  The value returned won't be derived from a potential window or texture. Rather, it will be directly mapped to the value provided to the automatic or window constructor.

## ◆ getUseStencil()

bool nkGraphics::RenderContextDescriptor::getUseStencil | ( |  | ) | const

Returns
  Whether the descriptor has been set to use a depth buffer with stencil (true) or not (false).

Remarks
  The value returned won't be derived from a potential depth texture provided. Rather, it will return the value set from the linked setter.

## ◆ setUseStencil()

void nkGraphics::RenderContextDescriptor::setUseStencil | ( | bool | v | ) |

Sets whether the render context should prepare to allow stencil use, or not. This value is only used if the depth target needs to be created by the render context. In other words, if an external texture is provided, the texture format takes precedence over this parameter.
Defaults to false.

Parameters

  v | If stencil is required (true) or not (false).

Remarks
  This parameter is off by default to accomodate better the reverse Z projection defaults which work better with a 32 bits depth format.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsGraphics/RenderContexts/RenderContextDescriptor.h